package Adapter;

public class MediaAdapter implements MediaPlayer{

    // 创建一个 "高级" 的 接口对象
    AdvanceMediaPlayer advanceMusicPlayer;


    // 声明一 有参构造函数
    public MediaAdapter(String audioType){
        if (audioType.equalsIgnoreCase("vlc")){
            advanceMusicPlayer = new VlcPlayer();
        } else if (audioType.equalsIgnoreCase("mp4")){
            advanceMusicPlayer = new Mp4Player();
        }
    }


    @Override
    public void play(String audioType, String fileName) {
        if (audioType.equalsIgnoreCase("vlc")){
            advanceMusicPlayer.playVlc(fileName);
        }else if (audioType.equalsIgnoreCase("mp4")){
            advanceMusicPlayer.playMp4(fileName);
        }
    }
}
